* **********************************************************************************;
* **********************************************************************************;
* "Military aid, regime vulnerability, and the escalation of political violence"   *;   
* Andrew Boutton (June 2019) 				                           *;                                      			   *;
* **********************************************************************************; 
* **********************************************************************************;



bys ccode: egen frac=total( usmilaidreceived ==1)
bys ccode: egen fracnoaid=total( usmilaidreceived ==0)
gen totalyrs = frac+fracnoaid
gen prmilaidusfrac = frac/totalyrs

gen inst2_hous = prmilaidusfrac*hfrag


gen instXnew5 = inst2_hous*newregime5

gen new5Xsecurity = newregime5*ln_securityMA



*************************
*** TABLE 1 MAIN TEXT ***
*************************

xtnbreg attks attkst_1 c.ln_securityMA i.newregime5  nldany coup1 physintlag2 rivalryt_1 ln_gdpt_1 ln_popt_1 civwar  mediascore i.year, fe

est store negbin1

xtnbreg attks attkst_1 c.ln_securityMA i.newregime5  i.newregime5#c.ln_securityMA  nldany coup1 physintlag2 rivalryt_1 ln_gdpt_1 ln_popt_1 civwar  mediascore i.year, fe

est store negbin2

reg ln_attks c.ln_securityMA i.newregime5 physintlag2 nldany coup1 rivalryt_1 ln_gdpt_1 ln_popt_1 civwar  mediascore i.year i.ccode, cl(gwf_casename)

est store ols1

reg ln_attks c.ln_securityMA i.newregime5  i.newregime5#c.ln_securityMA physintlag2 nldany coup1 rivalryt_1 ln_gdpt_1 ln_popt_1 civwar  mediascore i.year i.ccode, cl(gwf_casename)

est store ols2


************
*** 2SLS ***
************

ivreg2 ln_attks ( ln_securityMA=inst2_hous) newregime5  ln_gdpt_1  ln_popt_1 civwar physintlag coup1 nldany rivalryt_1 mediascore i.ccode i.year , cl(gwf_casename) partial(i.ccode i.year) first savefirst savefprefix(fs_1)

est store twostg

************************
*** 2SLS interaction ***
************************


ivreg2 ln_attks (new5Xsecurity ln_securityMA=inst2_hous instXnew5) newregime5  ln_gdpt_1  ln_popt_1 civwar physintlag rivalryt_1 mediascore coup1 nldany i.ccode i.year, cl(gwf_casename) partial(i.ccode i.year) first savefirst savefprefix(fs_2)

est store twostgint

lincom ln_securityMA
est store sec
lincom new5Xsecurity + ln_securityMA
est store newsec



esttab negbin1 negbin2 ols1 ols2 fs_1* twostg fs_2* twostgint using "main.tex", star(+ 0.10 * 0.05 ** 0.01 *** 0.001) se replace

************************************
*** NEW REGIMES AND REGIME TYPES ***
************************************
ivreg2 ln_attks attkst_1 (new5Xsecurity ln_securityMA=inst2_hous instXnew5) newregime5  ln_gdpt_1  ln_popt_1 civwar physintlag coup1 nldany rivalryt_1 mediascore i.year i.region if democ==1, cl(gwf_casename) partial(i.year i.region) first savefirst savefprefix(fs_dem)

lincom new5Xsecurity + ln_securityMA


est store dem

ivreg2 ln_attks attkst_1 (new5Xsecurity ln_securityMA=inst2_hous instXnew5) newregime5  ln_gdpt_1  ln_popt_1 civwar physintlag coup1 nldany rivalryt_1 mediascore i.year i.region if personal==1, cl(gwf_casename) partial(i.year i.region) first savefirst savefprefix(fs_pers)

lincom new5Xsecurity + ln_securityMA


est store pers

ivreg2 ln_attks attkst_1 (new5Xsecurity ln_securityMA=inst2_hous instXnew5) newregime5  ln_gdpt_1  ln_popt_1 civwar physintlag coup1 nldany rivalryt_1 mediascore i.year i.region if party==1, cl(gwf_casename) partial(i.year i.region) first savefirst savefprefix(fs_party)

lincom new5Xsecurity + ln_securityMA

est store party

* problem in the military junta model is that the sample is small, which results in a smaller F-statistic
ivreg2 ln_attks  ln_attkst_1 (new5Xsecurity ln_securityMA=inst2_hous instXnew5) newregime5  ln_gdpt_1  coup1 nldany ln_popt_1 civwar physintlag rivalryt_1 mediascore i.year i.region if milregime==1, cl(gwf_casename) partial(i.year i.region) first savefirst savefprefix(fs_milreg)

lincom new5Xsecurity + ln_securityMA


est store milreg


lincom ln_securityMA
est store sec
lincom new5Xsecurity + ln_securityMA
est store newsec

esttab fs_dem* dem fs_pers* pers fs_party* party fs_milreg* milreg using "C:\Users\an891720\Google Drive\tex files\regimesappendix2.tex", star(+ 0.10 * 0.05 ** 0.01 *** 0.001) b(a3) se(a3) replace



*************************************************
*** USING TIME-VARYING PR(AID) FOR INSTRUMENT ***
*************************************************
gen ptimevary=.
replace ptimevary=pdetente if year>=1970 & year<=1980
replace ptimevary=preagan if year>=1981 & year<=1990
replace ptimevary=ppostcw if year>=1991 & year<=2001
replace ptimevary=ppost911 if year>=2002 & year<=2010

gen insttv_hous = ptimevary*hfrag
gen insttvXnewreg = insttv_hous*newregime5

ivreg2 ln_attks (new5Xsecurity ln_securityMA=insttv_hous insttvXnewreg) newregime5  ln_gdpt_1  ln_popt_1 civwar physintlag coup1 nldany rivalryt_1 mediascore i.ccode i.year, cl(gwf_casename) partial(i.ccode i.year) first savefirst savefprefix(fs_tv)

est store tvary

esttab fs_tv* tvary using "C:\Users\an891720\Google Drive\tex files\tvary.tex", star(+ 0.10 * 0.05 ** 0.01 *** 0.001) b(3) se(3) replace




*************************************
*** DIFFERENT DEPENDENT VARIABLES ***
*************************************
ivreg2  ln_terrattks attkst_1 (new5Xsecurity ln_securityMA=inst2_hous instXnew5) newregime5  ln_gdpt_1  ln_popt_1 civwar physintlag rivalryt_1 mediascore coup1 nldany i.ccode i.year, cl(gwf_casename) partial(i.ccode i.year)

est store terr

ivreg2  ln_guerrattks attkst_1 (new5Xsecurity ln_securityMA=inst2_hous instXnew5) newregime5  ln_gdpt_1  ln_popt_1 civwar physintlag rivalryt_1 mediascore coup1 nldany i.ccode i.year, cl(gwf_casename) partial(i.ccode i.year)

est store guerr

ivreg2 mean9 neighbor_mean9 urban_pct econgrowth (new5Xsecurity ln_securityMA=inst2_hous instXnew5) newregime5  ln_gdpt_1  ln_popt_1  physintlag coup1 nldany urban_pct econgrowth ln_infmort_1 i.ccode i.year, cl(gwf_casename) partial(i.ccode i.year)

est store protest 

ivreg2  ln_attksother attkst_1 (new5Xsecurity ln_securityMA=inst2_hous instXnew5) newregime5  ln_gdpt_1  ln_popt_1 civwar physintlag rivalryt_1 mediascore coup1 nldany i.ccode i.year, cl(gwf_casename) partial(i.ccode i.year)

est store other


esttab terr guerr protest other using "C:\Users\atboutton\Google Drive\tex files\altdvs3.tex", star(+ 0.10 * 0.05 ** 0.01 *** 0.001) b(3) se(3) replace

ivreg2 ln_attks3rdpty attkst_1 (new5Xsecurity ln_securityMA=inst2_hous instXnew5) newregime5  ln_gdpt_1  ln_popt_1 civwar physintlag rivalryt_1 mediascore coup1 nldany i.ccode i.year, cl(gwf_casename) partial(i.ccode i.year) 

est store thirdpty



****************************
*** LEAVE-ONE-REGION-OUT ***
****************************
ivreg2 ln_attks (new5Xsecurity ln_securityMA=inst2_hous instXnew5) newregime5  ln_gdpt_1  ln_popt_1 civwar physintlag rivalryt_1 mediascore coup1 nldany i.ccode i.year if region!=1, cl(gwf_casename) partial(i.ccode i.year)

lincom ln_securityMA +new5Xsecurity

est store lo1

ivreg2 ln_attks (new5Xsecurity ln_securityMA=inst2_hous instXnew5) newregime5  ln_gdpt_1  ln_popt_1 civwar physintlag rivalryt_1 mediascore coup1 nldany i.ccode i.year if region!=2, cl(gwf_casename) partial(i.ccode i.year)

lincom ln_securityMA +new5Xsecurity

est store lo2

ivreg2 ln_attks (new5Xsecurity ln_securityMA=inst2_hous instXnew5) newregime5  ln_gdpt_1  ln_popt_1 civwar physintlag rivalryt_1 mediascore coup1 nldany i.ccode i.year if region!=3, cl(gwf_casename) partial(i.ccode i.year)

lincom ln_securityMA +new5Xsecurity

est store lo3

ivreg2 ln_attks (new5Xsecurity ln_securityMA=inst2_hous instXnew5) newregime5  ln_gdpt_1  ln_popt_1 civwar physintlag rivalryt_1 mediascore coup1 nldany i.ccode i.year if region!=4, cl(gwf_casename) partial(i.ccode i.year)

lincom ln_securityMA +new5Xsecurity

est store lo4

ivreg2 ln_attks (new5Xsecurity ln_securityMA=inst2_hous instXnew5) newregime5  ln_gdpt_1  ln_popt_1 civwar physintlag rivalryt_1 mediascore coup1 nldany i.ccode i.year if region!=5, cl(gwf_casename) partial(i.ccode i.year)

lincom ln_securityMA +new5Xsecurity

est store lo5

ivreg2 ln_attks (new5Xsecurity ln_securityMA=inst2_hous instXnew5) newregime5  ln_gdpt_1  ln_popt_1 civwar physintlag rivalryt_1 mediascore coup1 nldany i.ccode i.year if region!=6, cl(gwf_casename) partial(i.ccode i.year)

lincom ln_securityMA +new5Xsecurity

est store lo6

ivreg2 ln_attks (new5Xsecurity ln_securityMA=inst2_hous instXnew5) newregime5  ln_gdpt_1  ln_popt_1 civwar physintlag rivalryt_1 mediascore coup1 nldany i.ccode i.year if region!=7, cl(gwf_casename) partial(i.ccode i.year)

lincom ln_securityMA +new5Xsecurity

est store lo7

ivreg2 ln_attks (new5Xsecurity ln_securityMA=inst2_hous instXnew5) newregime5  ln_gdpt_1  ln_popt_1 civwar physintlag rivalryt_1 mediascore coup1 nldany i.ccode i.year if region!=8, cl(gwf_casename) partial(i.ccode i.year)

lincom ln_securityMA +new5Xsecurity

est store lo8

esttab lo1 lo2 lo3 lo4 lo5 lo6 lo7 lo8 using "C:\Users\an891720\Google Drive\tex files\leaveout.tex", star(+ 0.10 * 0.05 ** 0.01 *** 0.001) b(3) se(3) replace

******************************
*** COLD WAR/POST-COLD WAR ***
******************************
ivreg2 ln_attks (new5Xsecurity ln_securityMA=inst2_hous instXnew) newregime5  ln_gdpt_1  ln_popt_1 civwar physintlag rivalryt_1 mediascore coup1 nldany i.ccode i.year if coldwar==1, cl(gwf_casename) partial(i.ccode i.year) 


ivreg2 ln_attks (new5Xsecurity ln_securityMA=inst2_hous instXnew) newregime5  ln_gdpt_1  ln_popt_1 civwar physintlag coup1 nldany i.year if coldwar==0, cl(gwf_casename)


**********************
** HAC errors, 2SLS **
**********************
xi: ivreg2 ln_attks attkst_1 (new5Xsecurity ln_securityMA=inst2_hous instXnew5) newregime5  ln_gdpt_1  ln_popt_1 civwar physintlag coup1 nldany rivalryt_1 mediascore i.ccode i.year, bw() rob partial(i.ccode i.year)

est store hac

**************************
** RANDOM EFFECTS, 2SLS **
**************************

xtivreg ln_attks attkst_1 (new5Xsecurity ln_securityMA=inst2_hous instXnew5) newregime5  ln_gdpt_1  ln_popt_1 civwar physintlag coup1 nldany rivalryt_1 mediascore, re

est store rand

**************************************************
*** CLUSTER ON COUNTRY RATHER THAN REGIME CASE ***
**************************************************
ivreg2 ln_attks attkst_1 (new5Xsecurity ln_securityMA=inst2_hous instXnew5) newregime5  ln_gdpt_1  ln_popt_1 civwar physintlag nldany coup1 mediascore rivalryt_1 i.year i.ccode, cl(ccode) partial(i.ccode i.year)

est store clust

lincom new5Xsecurity + ln_securityMA

esttab hac rand clust using "C:\Users\atboutton\Google Drive\tex files\alternate.tex", star(+ 0.10 * 0.05 ** 0.01 *** 0.001) b(3) se(3) replace

************************************************
*** 3, 10, and 20-YEAR NEW REGIME THRESHOLDS ***
************************************************
gen newregime3 = 1 if regimeage < 4
replace newregime3 = 0 if regimeage > 3
gen new3XsecurityMA = newregime3*ln_securityMA
gen instXnew3 = inst2_hous*newregime3

ivreg2 ln_attks attkst_1 (new3XsecurityMA ln_securityMA =inst2_hous instXnew3) newregime3  ln_gdpt_1  ln_popt_1 civwar physintlag coup1 nldany rivalryt_1 mediascore i.ccode i.year, cl(gwf_casename) partial(i.ccode i.year)

lincom new3XsecurityMA + ln_securityMA 

est store new3 

gen newregime10 = 1 if regimeage < 11
replace newregime10 = 0 if regimeage > 10
gen new10XsecurityMA = newregime10*ln_securityMA
gen instXnew10 = inst2_hous*newregime10

ivreg2 ln_attks attkst_1 (new10XsecurityMA ln_securityMA =inst2_hous instXnew10) newregime10  ln_gdpt_1  ln_popt_1 civwar physintlag coup1 nldany rivalryt_1 mediascore i.ccode i.year, cl(gwf_casename) partial(i.ccode i.year)

lincom new10XsecurityMA + ln_securityMA 

est store new10

ivreg2 ln_attks attkst_1 (new15XsecurityMA ln_securityMA =inst2_hous instXnew15) newregime15  ln_gdpt_1  ln_popt_1 civwar physintlag coup1 nldany rivalryt_1 mediascore i.ccode i.year, cl(gwf_casename) partial(i.ccode i.year)

lincom new15XsecurityMA + ln_securityMA 


est store new15

gen newregime20 = 1 if regimeage < 21
replace newregime20 = 0 if regimeage > 20
gen new20XsecurityMA = newregime20*ln_securityMA
gen instXnew20 = inst2_hous*newregime20

ivreg2 ln_attks attkst_1 (new20XsecurityMA ln_securityMA =inst2_hous instXnew20) newregime20  ln_gdpt_1  ln_popt_1 civwar physintlag coup1 nldany rivalryt_1 mediascore i.ccode i.year, cl(gwf_casename) partial(i.ccode i.year)

lincom new20XsecurityMA + ln_securityMA 

est store new20

esttab new3 new10 new15 new20 using "C:\Users\an891720\Google Drive\tex files\thresholds.tex", star(+ 0.10 * 0.05 ** 0.01 *** 0.001) b(3) se(3) replace

********************************************************************************
*** COUP PROBABILITY AS MEASURE OF REGIME FRAGILITY (ADAPTED FROM KOGA 2017) ***
********************************************************************************
ivreg2 ln_attks attkst_1 (dp2Xsecurity ln_securityMA=inst2_hous instXdp2 ) dp2  ln_gdpt_1  ln_popt_1 civwar physintlag rivalryt_1 mediascore coup1 nldany i.ccode i.year, cl(gwf_casename) partial(i.ccode i.year)



*******************************************
*** GENERATING TIME-VARYING PROBABILITY ***
*******************************************
* 4 PERIODS: Detente (1970-1980), Reagan (1981-1990), Post CW (1991-2001), Post 9/11 (2002-2009)
sort ccode year

* Nixon-Carter (1970-1980): 9 years
sort cname year
by cname: egen sum_detente=sum(usaidrecipient) if year>=1970 & year<=1980
gen pdetente=sum_detente/9
label var pdetente "Probability of receiving U.S. aid during Detente (1970-1980)"

* Reagan (1981-1990): 10 years
sort cname year
by cname: egen sum_reagan=sum(usaidrecipient) if year>=1981 & year<=1990
gen preagan=sum_reagan/10
label var preagan "Probability of receiving U.S. aid during Reagan years (1981-1990)"

* Post Cold War (1991-2001): 11 years
by cname: egen sum_postcw=sum(usaidrecipient) if year>=1991 & year<=2001
gen ppostcw=sum_postcw/11
label var ppostcw "Probability of receiving U.S. aid during post-Cold War years (1991-2001)"

* Post 9/11 (2002-2009): 8 years
by cname: egen sum_post911=sum(usaidrecipient) if year>=2002 & year<=2009
gen ppost911=sum_post911/8
label var ppost911 "Probability of receiving U.S. aid during post-9/11 years (2002-2010)"

* Combine these

*************************************************
*** USING TIME-VARYING PR(AID) FOR INSTRUMENT ***
*************************************************
gen ptimevary=.
replace ptimevary=pdetente if year>=1970 & year<=1980
replace ptimevary=preagan if year>=1981 & year<=1990
replace ptimevary=ppostcw if year>=1991 & year<=2001
replace ptimevary=ppost911 if year>=2002 & year<=2010

gen insttv_hous = ptimevary*hfrag
gen insttvXnewreg = insttv_hous*newregime5

ivreg2 ln_attks (new5Xsecurity ln_securityMA=insttv_hous insttvXnewreg) newregime5  ln_gdpt_1  ln_popt_1 civwar physintlag coup1 nldany rivalryt_1 mediascore i.ccode i.year, cl(gwf_casename) partial(i.ccode i.year) first savefirst savefprefix(fs_tv)

est store tvary

esttab fs_tv* tvary using "C:\Users\an891720\Google Drive\tex files\tvary.tex", star(+ 0.10 * 0.05 ** 0.01 *** 0.001) b(3) se(3) replace




*******************************************************
*** Construct moving average of House fragmentation ***
*******************************************************
ivreg2 ln_attks (new5Xsecurity ln_securityMA=inst2_hous instXnew5) newregime5  ln_gdpt_1  ln_popt_1 civwar physintlag rivalryt_1 mediascore coup1 nldany i.ccode i.year, cl(gwf_casename) partial(i.ccode i.year) 

gen s = e(sample)
keep if s==1
sort ccode year
gen inst_housMA = (L3.inst2_hous + L2.inst2_hous + L1.inst2_hous) / 3 

gen inst2maXnew5 = inst_housMA*newregime5

ivreg2 ln_attks (ln_securityMA= inst_housMA) newregime5  ln_gdpt_1  ln_popt_1 civwar physintlag rivalryt_1 mediascore coup1 nldany i.ccode i.year, cl(gwf_casename) partial(i.ccode i.year) first savefirst savefprefix(fs_1)

est store noint

ivreg2 ln_attks (new5Xsecurity ln_securityMA= inst_housMA inst2maXnew5 ) newregime5  ln_gdpt_1  ln_popt_1 civwar physintlag rivalryt_1 mediascore coup1 nldany i.ccode i.year, cl(gwf_casename) partial(i.ccode i.year) first savefirst savefprefix(fs_2)

est store interac

esttab fs_1* noint fs_2* interac using "C:\Users\atboutton\Google Drive\tex files\moveave.tex", star(+ 0.10 * 0.05 ** 0.01 *** 0.001) se replace


*******************************************
*** REGIME TYPE MOVING AVERAGE ANALYSIS ***
*******************************************
ivreg2 ln_attks attkst_1 (new5Xsecurity ln_securityMA= inst_housMA inst2maXnew5) newregime5  ln_gdpt_1  ln_popt_1 civwar physintlag coup1 nldany rivalryt_1 mediascore i.year i.region if democ==1, cl(gwf_casename) partial(i.year i.region) 

lincom new5Xsecurity + ln_securityMA

est store dem

ivreg2 ln_attks attkst_1 (new5Xsecurity ln_securityMA= inst_housMA inst2maXnew5 ) newregime5  ln_gdpt_1  ln_popt_1 civwar physintlag coup1 nldany rivalryt_1 mediascore i.year i.region if personal==1, cl(gwf_casename) partial(i.year i.region) 

lincom new5Xsecurity + ln_securityMA


est store pers

ivreg2 ln_attks attkst_1 (new5Xsecurity ln_securityMA= inst_housMA inst2maXnew5) newregime5  ln_gdpt_1  ln_popt_1 civwar physintlag coup1 nldany rivalryt_1 mediascore i.year i.region if party==1, cl(gwf_casename) partial(i.year i.region) 

lincom new5Xsecurity + ln_securityMA

est store party

* problem here is that the sample is small, which depresses the F-statistic
ivreg2 ln_attks  ln_attkst_1 (new5Xsecurity ln_securityMA= inst_housMA inst2maXnew5 ) newregime5  ln_gdpt_1  coup1 nldany ln_popt_1 civwar physintlag rivalryt_1 mediascore i.year i.region if milregime==1, cl(gwf_casename) 

lincom new5Xsecurity + ln_securityMA

est store junta

esttab fs_1* noint fs_2* interac using "C:\Users\atboutton\Google Drive\tex files\moveaveregime.tex", star(+ 0.10 * 0.05 ** 0.01 *** 0.001) se replace



****************************************
*** EXCLUDING CIVIL WAR OBSERVATIONS ***
****************************************
ivreg2 ln_attks (new5Xsecurity ln_securityMA=inst2_hous instXnew5) newregime5  ln_gdpt_1  ln_popt_1 civwar physintlag rivalryt_1 mediascore coup1 nldany i.ccode i.year if civwar==0, cl(gwf_casename) partial(i.ccode i.year)

lincom new5Xsecurity + ln_securityMA

ivreg2 ln_attks attkst_1 (new5Xsecurity ln_securityMA=inst2_hous instXnew5) newregime5  ln_gdpt_1  ln_popt_1 civwar physintlag coup1 nldany rivalryt_1 mediascore i.year i.region if democ==1 & civwar==0, cl(gwf_casename) partial(i.year i.region)

lincom new5Xsecurity + ln_securityMA

ivreg2 ln_attks attkst_1 (new5Xsecurity ln_securityMA=inst2_hous instXnew5) newregime5  ln_gdpt_1  ln_popt_1 civwar physintlag coup1 nldany rivalryt_1 mediascore i.year i.region if personal==1 & civwar==0, cl(gwf_casename) partial(i.year i.region)


**************************
*** EXCLUDING OUTLIERS ***
**************************
_pctile ln_securityMA, p(85, 90)

return list

ivreg2 ln_attks attkst_1 (new5Xsecurity ln_securityMA=inst2_hous instXnew5) newregime5  ln_gdpt_1  ln_popt_1 civwar physintlag rivalryt_1 mediascore coup1 nldany i.ccode i.year if ln_securityMA<17.5, cl(gwf_casename) partial(i.ccode i.year) first savefirst savefprefix(fs_1)

est store interac


lincom new5Xsecurity + ln_securityMA

esttab fs_1* interac using "C:\Users\atboutton\Google Drive\tex files\outliersmain.tex", star(+ 0.10 * 0.05 ** 0.01 *** 0.001) b(a3) se(a3) replace


ivreg2 ln_attks attkst_1 (new5Xsecurity ln_securityMA=inst2_hous instXnew5) newregime5  ln_gdpt_1  ln_popt_1 civwar physintlag coup1 nldany rivalryt_1 mediascore i.year i.region if democ==1 & ln_securityMA<18, cl(gwf_casename) partial(i.year i.region) first savefirst savefprefix(fs_dem)

est store dem

ivreg2 ln_attks attkst_1 (new5Xsecurity ln_securityMA=inst2_hous instXnew5) newregime5  ln_gdpt_1  ln_popt_1 civwar physintlag coup1 nldany rivalryt_1 mediascore i.year i.region if personal==1 & ln_securityMA<18, cl(gwf_casename) partial(i.year i.region) first savefirst savefprefix(fs_pers)

est store pers

ivreg2 ln_attks attkst_1 (new5Xsecurity ln_securityMA=inst2_hous instXnew5) newregime5  ln_gdpt_1  ln_popt_1 civwar physintlag coup1 nldany rivalryt_1 mediascore i.year i.region if party==1 & ln_securityMA<18, cl(gwf_casename) partial(i.year i.region) first savefirst savefprefix(fs_party)

est store party

* problem here is that the sample is small, which depresses the F-statistic
ivreg2 ln_attks  ln_attkst_1 (new5Xsecurity ln_securityMA=inst2_hous instXnew5) newregime5  ln_gdpt_1  coup1 nldany ln_popt_1 civwar physintlag rivalryt_1 mediascore i.year i.region if milregime==1 & ln_securityMA<18, cl(gwf_casename) partial(i.year i.region) first savefirst savefprefix(fs_milreg)


est store milreg


esttab fs_dem* dem fs_pers* pers fs_party* party fs_milreg* milreg using "C:\Users\an891720\Google Drive\tex files\outliersregime.tex", star(+ 0.10 * 0.05 ** 0.01 *** 0.001) b(3) se(3) replace

***************************
*** ADDITIONAL CONTROLS ***
***************************
ivreg2 ln_attks (new5Xsecurity ln_securityMA=inst2_hous instXnew5) newregime5  ln_gdpt_1  ln_popt_1 civwar physintlag rivalryt_1 mediascore coup1 nldany i.region i.ccode i.year, cl(gwf_casename) partial(i.ccode i.region i.year) 

est store region

ivreg2 ln_attks (new5Xsecurity ln_securityMA=inst2_hous instXnew5) newregime5  ln_gdpt_1  ln_popt_1 civwar physintlag rivalryt_1 mediascore coup1 nldany econgrowth i.ccode i.year, cl(gwf_casename) partial(i.ccode i.year) 

est store econ

ivreg2 ln_attks (new5Xsecurity ln_securityMA=inst2_hous instXnew5) newregime5  ln_gdpt_1  ln_popt_1 civwar physintlag rivalryt_1 mediascore coup1 nldany urban_pct i.ccode i.year, cl(gwf_casename) partial(i.ccode i.year) 

est store urban

ivreg2 ln_attks (new5Xsecurity ln_securityMA=inst2_hous instXnew5) newregime5  ln_gdpt_1  ln_popt_1 civwar physintlag rivalryt_1 mediascore coup1 nldany ln_ross_resources i.ccode i.year, cl(gwf_casename) partial(i.ccode i.year) 

est store ross

ivreg2 ln_attks (new5Xsecurity ln_securityMA=inst2_hous instXnew5) newregime5  ln_gdpt_1  ln_popt_1 civwar physintlag rivalryt_1 mediascore coup1 nldany ln_troops i.ccode i.year, cl(gwf_casename) partial(i.ccode i.year) 

est store troops

ivreg2 ln_attks (new5Xsecurity ln_securityMA=inst2_hous instXnew5) newregime5  ln_gdpt_1  ln_popt_1 civwar physintlag rivalryt_1 mediascore coup1 nldany log_milex_soldier i.ccode i.year, cl(gwf_casename) partial(i.ccode i.year) 

est store milex

esttab region econ urban ross troops milex using "controls.tex", star(+ 0.10 * 0.05 ** 0.01 *** 0.001) b(3) se(3) replace


************************************************
*** REGIME TYPE + ALT. NEW REGIME THRESHOLDS ***
************************************************

ivreg2 ln_attks attkst_1 (new3XsecurityMA ln_securityMA =inst2_hous instXnew3) newregime3  ln_gdpt_1  ln_popt_1 civwar physintlag coup1 nldany rivalryt_1 mediascore i.region i.year if democ==1, cl(gwf_casename) partial(i.region i.year)

lincom new3XsecurityMA + ln_securityMA 

est store new3 

ivreg2 ln_attks attkst_1 (new10XsecurityMA ln_securityMA =inst2_hous instXnew10) newregime10  ln_gdpt_1  ln_popt_1 civwar physintlag coup1 nldany rivalryt_1 mediascore i.region i.year if democ==1, cl(gwf_casename) partial(i.region i.year)

lincom new10XsecurityMA + ln_securityMA 

est store new10

ivreg2 ln_attks attkst_1 (new15XsecurityMA ln_securityMA =inst2_hous instXnew15) newregime15  ln_gdpt_1  ln_popt_1 civwar physintlag coup1 nldany rivalryt_1 mediascore i.region i.year if democ==1, cl(gwf_casename) partial(i.region i.year)

lincom new15XsecurityMA + ln_securityMA 


est store new15

esttab new3 new10 new15 using "C:\Users\an891720\Google Drive\tex files\demthresh.tex", star(+ 0.10 * 0.05 ** 0.01 *** 0.001) b(3) se(3) replace


